<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!-- page start from 0, the jsp display from 1 -->
<c:if test="${page.totalCount > 0}">
	<a href="javascript:spaceIndexMoodList(${usr},'1_${page.pageSize}');">
		<fmt:message key="common.pager.html.first"/>
	</a>
	<c:if test="${page.pageIndex - 1 > 0}"> <!-- make sure current page > 1 show 'prev' -->
		<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex - 1}_${page.pageSize}');">
			<fmt:message key="common.pager.html.pre"/>
		</a>
	</c:if>
	
	<c:if test="${page.totalPage > 0}">
		<!-- the displayed page before current page -->
		<c:if test="${page.pageIndex - 2 >= 1}"><!-- current page > 3 -->
			<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex - 2}_${page.pageSize}');">
				${page.pageIndex - 2}
			</a>
			<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex - 1}_${page.pageSize}');">
				${page.pageIndex - 1}
			</a>
		</c:if>
		<c:if test="${page.pageIndex - 2 == 0}"> <!-- current page == 2 -->
			<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex - 1}_${page.pageSize}');">
				${page.pageIndex - 1}
			</a>
		</c:if>
		
		<!-- current page -->
		<a class="pagediva" href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex}_${page.pageSize}');">
			${page.pageIndex}
		</a>
		
		<!-- thie displayed page after current page -->
		<c:if test="${page.totalPage - page.pageIndex - 2 >= 0 }">
			<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex + 1}_${page.pageSize}');">
				${page.pageIndex + 1}
			</a>
			<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex + 2}_${page.pageSize}');">
				${page.pageIndex + 2}
			</a>
		</c:if>
		<c:if test="${page.totalPage - page.pageIndex - 2  == -1}"> <!-- current page == 2 -->
			<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex + 1}_${page.pageSize}');">
				${page.pageIndex + 1}
			</a>
		</c:if>
	</c:if>
	<c:if test="${page.totalPage - page.pageIndex > 0}">
		<a href="javascript:spaceIndexMoodList(${usr},'${page.pageIndex + 1}_${page.pageSize}');">
			<fmt:message key="common.pager.html.next"/>
		</a>
	</c:if>
	<a href="javascript:spaceIndexMoodList(${usr},'${page.totalPage}_${page.pageSize}');">
		<fmt:message key="common.pager.html.last"/>
	</a>
</c:if>
